package 线程安全.多线程;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketAddress;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;

public class Server {
    public static void main(String[] args) throws IOException {
        HashMap<SocketAddress, SendMsg> clientList = new HashMap<>();
        ServerSocket ssk = new ServerSocket(12021);
        while (true) {
            Socket accept = ssk.accept();
            System.out.println("接受客户端！");
            System.out.println("IP:" + accept.getRemoteSocketAddress());
            new Thread(new ServerMsg(accept, clientList)).start();
        }
    }
}
